{#**
 * 2007-2020 PrestaShop SA and Contributors
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2020 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *#}

{% trans_default_domain "Admin.Shopparameters.Feature" %}
{% import '@PrestaShop/Admin/macros.html.twig' as ps %}

{% block set_up_urls_configuration %}
  <div class="card">
    <h3 class="card-header">
      <i class="material-icons">settings</i> {{ 'Set up URLs'|trans }}
    </h3>
    <div class="card-block row">
      <div class="card-text">

        {% if not isHtaccessFileValid %}
          <div class="row">
            <div class="col-sm">
              <div class="alert alert-info" role="alert">
                <div class="alert-text">
                  {{ 'Before you can use this tool, you need to:'|trans({}, 'Admin.Shopparameters.Notification') }}
                  <br>
                  {{ '1) Create a blank .htaccess file in your root directory.'|trans({}, 'Admin.Shopparameters.Notification') }}
                  <br>
                  {{ '2) Give it write permissions (CHMOD 666 on Unix system).'|trans({}, 'Admin.Shopparameters.Notification') }}
                </div>
              </div>
            </div>
          </div>
        {% endif %}

        <div class="form-group row">
          {% if isModRewriteActive %}
            {{ ps.label_with_help('Friendly URL'|trans({}, 'Admin.Global'), ('Enable this option only if your server allows URL rewriting (recommended).'|trans({}, 'Admin.Shopparameters.Help'))) }}
          {% endif %}
          <div class="col-sm">
            {{ form_errors(metaForm.set_up_urls.friendly_url) }}
            {{ form_widget(metaForm.set_up_urls.friendly_url) }}

            {% if not isModRewriteActive %}
              <small class="form-text">
                {{ 'URL rewriting (mod_rewrite) is not active on your server, or it is not possible to check your server configuration. If you want to use Friendly URLs, you must activate this mod.'|trans({}, 'Admin.Shopparameters.Help') }}
              </small>
            {% endif %}
          </div>
        </div>

        <div class="form-group row">
          {{ ps.label_with_help(('Accented URL'|trans), ('Enable this option if you want to allow accented characters in your friendly URLs.'|trans({}, 'Admin.Shopparameters.Help') ~ ' ' ~ 'You should only activate this option if you are using non-latin characters ; for all the latin charsets, your SEO will be better without this option.'|trans({}, 'Admin.Shopparameters.Help'))) }}
          <div class="col-sm">
            {{ form_errors(metaForm.set_up_urls.accented_url) }}
            {{ form_widget(metaForm.set_up_urls.accented_url) }}
          </div>
        </div>

        <div class="form-group row">
          <label class="form-control-label">{{ 'Redirect to the canonical URL'|trans }}</label>
          <div class="col-sm">
            {{ form_errors(metaForm.set_up_urls.canonical_url_redirection) }}
            {{ form_widget(metaForm.set_up_urls.canonical_url_redirection) }}
          </div>
        </div>

        {% if metaForm.set_up_urls.disable_apache_multiview is defined %}
          <div class="form-group row">
            {{ ps.label_with_help(("Disable Apache's MultiViews option"|trans), ('Enable this option only if you have problems with URL rewriting.'|trans({}, 'Admin.Shopparameters.Help'))) }}
            <div class="col-sm">
              {{ form_errors(metaForm.set_up_urls.disable_apache_multiview) }}
              {{ form_widget(metaForm.set_up_urls.disable_apache_multiview) }}
            </div>
          </div>
        {% endif %}

        {% if metaForm.set_up_urls.disable_apache_mod_security is defined %}
          <div class="form-group row">
            {{ ps.label_with_help(("Disable Apache's mod_security module"|trans), ("Some of PrestaShop's features might not work correctly with a specific configuration of Apache's mod_security module. We recommend to turn it off."|trans({}, 'Admin.Shopparameters.Help'))) }}
            <div class="col-sm">
              {{ form_errors(metaForm.set_up_urls.disable_apache_mod_security) }}
              {{ form_widget(metaForm.set_up_urls.disable_apache_mod_security) }}
            </div>
          </div>
        {% endif %}

        {% block meta_form_rest %}
          {{ form_rest(metaForm.set_up_urls) }}
        {% endblock %}
      </div>
    </div>
    <div class="card-footer">
      <div class="d-flex justify-content-end">
        <button class="btn btn-primary">{{ 'Save'|trans({}, 'Admin.Actions') }}</button>
      </div>
    </div>
  </div>
{% endblock %}
